<template>
	<view class="copyApplay">
		<u-overlay :show="showMask"></u-overlay>
		<template>
			<u-notify ref="uNotify"  message="Hi uView" :show="notifyShow" ></u-notify>
		</template>
		<view class="copyApplayPadding">
				<view v-if="!isDisabled">
					<u-steps :current="current" >
						<u-steps-item title="完善信息" >
						</u-steps-item>
						<u-steps-item title="填写地址" ></u-steps-item>
						<u-steps-item title="支付订单" ></u-steps-item>
					</u-steps>
					<u-divider ></u-divider>
					<view class="message">
						请准确填写相关信息并提交给医院审核！
					</view>
					<u-divider ></u-divider>
				</view>
				
				
				
				<view>
						<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
						<u--form
								labelPosition="left"
								labelWidth='100'
								:model="model1"
								:rules="rules"
								:labelStyle="labelStyle"
								ref="uForm">
							<u-form-item
									label="申请类型"
									prop="userInfo.atype"
									borderBottom
									style="margin-bottom: 10upx;font-weight: bold;">
								<u-radio-group
								    v-model="model1.userInfo.atype"
								    placement="row"
								    @change="groupChange"
									:disabled="isDisabled"
									disabledColor="#ffffff" 
								  >
								    <u-radio
								      :customStyle="{marginBottom: '8px',marginRight:'10px'}"
								      v-for="(item, index) in radiolist1"
								      :key="index"
								      :label="item.name"
								      :name="item.id"
								    >
								    </u-radio>
								</u-radio-group>
							</u-form-item>
							<u-form-item
									label="患者姓名"
									prop="userInfo.hzxm"
									borderBottom
									style="margin-bottom: 10px;">
								<u--input
										v-model="model1.userInfo.hzxm"
										border="none"
										placeholder="请输入内容"
										:disabled="isDisabled"
										disabledColor="#ffffff" 
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="患者身份证号"
									prop="userInfo.hzsfzh"
									borderBottom
									style="margin-bottom: 10px;">
								<u--input
										v-model="model1.userInfo.hzsfzh"
										border="none"
										placeholder="请输入内容"
										@blur="blurSfzEvent"
										:disabled="isDisabled"
										disabledColor="#ffffff" 
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="患者手机号"
									prop="userInfo.hzlxdh"
									borderBottom
									style="margin-bottom: 10px;">
								<u--input
										v-model="model1.userInfo.hzlxdh"
										border="none"
										placeholder="请输入内容"
										:disabled="isDisabled"
										disabledColor="#ffffff" 
								></u--input>
							</u-form-item>
							
							
							<u-form-item
									label="住院号"
									prop="userInfo.blh"
									borderBottom
									style="margin-bottom: 10px;"
									@click="showSex = true;">
								<u--input
										v-model="model1.userInfo.blh"
										disabled
										disabledColor="#ffffff"
										placeholder="请选择"
										border="none"
								></u--input>
								<u-action-sheet
									:show="showSex"
									:actions="actions"
									title="请选择"
									@close="showSex = false"
									@select="sexSelect"
									v-if="!isDisabled">
								</u-action-sheet>
								<u-icon
										slot="right"
										name="arrow-right"
										v-if="!isDisabled"
								></u-icon>
							</u-form-item>
							
							<u-form-item
									label="出院科室"
									prop="userInfo.cyks"
									borderBottom
									style="margin-bottom: 10px;">
								<u--input
										v-model="model1.userInfo.cyks"
										border="none"
										placeholder="请输入内容"
										:disabled="isDisabled"
										disabledColor="#ffffff" 
								></u--input>
							</u-form-item>
							
							<u-form-item
									label="出院日期"
									prop="userInfo.cyrq"
									borderBottom
									style="margin-bottom: 10px;">
									<u--input
											v-model="model1.userInfo.cyrq"
											disabled
											disabledColor="#ffffff" 
											border="none"
											@click="dateShow = true"
									></u--input>
								<u-datetime-picker
										v-if="!isDisabled"
										:show="dateShow"
										v-model="dateTime"
										mode="date"
										@confirm="dateConfirm"
										@cancel="dateShow = false"
										
										>
								</u-datetime-picker>
								<u-icon v-if="!isDisabled" @click="dateShow = true" name="arrow-right"></u-icon>
							</u-form-item>
							
							<u-form-item
									label="份数"
									prop="userInfo.anum"
									borderBottom
									style="margin-bottom: 10px;">
								<u-number-box 
									disabledColor="#ffffff"  
									:disabled="isDisabled" 
									v-model="model1.userInfo.anum">
								</u-number-box>
							</u-form-item>
							
							<u-form-item
									label="复印内容"
									prop="acontent"
									style="margin-bottom: 10px;"
									:customStyle="{height:'250upx'}">
								<view class="" style="width: 70%;flex-wrap: wrap;position: absolute;height: 250upx;">
									<u-checkbox-group>
										<u-checkbox  
										label="全选"
										:checked="allChecked"
										:customStyle="{marginBottom: '15px',fontWeight:'bold'}"
										@change="selectAllCheckbox"
										:disabled="isDisabled"
										disabledColor="#ffffff" >
										</u-checkbox>
									</u-checkbox-group>
									<u-checkbox-group
										v-model="acontent"
										placement="row"
										style="flex-wrap: wrap;position: absolute;height: 200upx;font-weight: bold;"
										>
										<u-checkbox
											:disabled="isDisabled"
											:customStyle="{marginBottom: '15px',marginRight:'10px'}"
											v-for="(item, index) in checkboxList1"
											:key="index"
											:label="item.name"
											:name="item.id"
											:checked="checked"
										>
										</u-checkbox>
									</u-checkbox-group>
								</view>
								
								
							</u-form-item>
							<view class="info">
								*如需特殊检查报告单或钢板型号合格证，请在备注栏中注明
							</view>
							<u-divider ></u-divider>
							<u-form-item
									label="备注"
									prop="userInfo.remarks"
									borderBottom
									style="margin-bottom: 10px;">
								<u--textarea 
									:disabled="isDisabled"
									disabledColor="#ffffff" 
									v-model="model1.userInfo.remarks" 
									height='40' 
									placeholder="请输入内容" 
									 ></u--textarea>
								 <!-- <u--input
									placeholder="请输入内容"
									border="surround"
									v-model="model1.userInfo.bz"
								  ></u--input> -->
							</u-form-item>
							<u-form-item
									label="申请事由"
									prop="userInfo.areason"
									style="margin-bottom: 10px;"
									@click="decShow = true;"
									>
									<u--input
											v-model="model1.userInfo.areason"
											disabled
											disabledColor="#ffffff"
											placeholder="请选择"
											border="none"
									></u--input>
									
									<u-action-sheet
										v-if="!isDisabled"
										:show="decShow"
										:actions="actionsDec"
										title="请选择"
										@close="decShow = false"
										@select="decSelect">
									</u-action-sheet>
									<u-icon
											slot="right"
											name="arrow-right"
											v-if="!isDisabled"
									></u-icon>
							</u-form-item>
							<u-form-item
									label="其他事由"
									style="margin-bottom: 10upx;"
									prop="userInfo.aotherReason"
									v-if="model1.userInfo.areason == '其他'"
									>
									<u--textarea :disabled="isDisabled" v-model="model1.userInfo.aotherReason" placeholder="请输入其他事由" autoHeight ></u--textarea>
							</u-form-item>
							
							<u-divider></u-divider>
							
							
							<view class="picTitle">
								上传患者本人身份证
							</view>
							<!-- 代理人申请 -->
							<u-form-item
								label=""
								v-if="isSelf"
								style="margin-bottom: 10px;"
								>
								<u-upload
									:disabled="isDisabled"
									:previewFullImage="false"
									:deletable="false"
									:auto-upload="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadProxyHoldCard" 
								>
									<image :src="model1.userInfo.proxyHoldCard" 
									mode="aspectFit" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传代理人手持身份证半身照</p>
								</u-upload>
							</u-form-item>
							<u-form-item
								label=""
								v-if="isSelf"
								style="margin-bottom: 10px;"
								>
								<u-upload
									:disabled="isDisabled"
									:previewFullImage="false"
									:deletable="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadproxyFrontCard" 
								>
									<image :src="model1.userInfo.proxyFrontCard"
									mode="widthFix" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传代理人身份证正面照</p>
								</u-upload>
							</u-form-item>
							<u-form-item
								label=""
								v-if="isSelf"
								style="margin-bottom: 10px;"
								>
								<u-upload
									:previewFullImage="false"
									:deletable="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadproxyBackCard" 
									:disabled="isDisabled"
								>
									<image :src="model1.userInfo.proxyBackCard"
									mode="widthFix" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传代理人身份证背面照</p>
								</u-upload>
							</u-form-item>
							<u-form-item
								label=""
								style="margin-bottom: 10px;"
								>
								<u-upload
									:previewFullImage="false"
									:deletable="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadhzHoldCard" 
									:disabled="isDisabled"
								>
									<image :src="model1.userInfo.hzHoldCard"
									mode="widthFix" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传患者手持身份证半身照片</p>
								</u-upload>
							</u-form-item>
							<u-form-item
								label=""
								style="margin-bottom: 10px;"
								>
								<u-upload
									:previewFullImage="false"
									:deletable="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadhzFrontCard" 
									:disabled="isDisabled"
								>
									<image :src="model1.userInfo.hzFrontCard"
									mode="widthFix" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传患者身份证正面照</p>
								</u-upload>
								</u-form-item>
								<u-form-item
									label=""
									style="margin-bottom: 10px;"
									>
								<u-upload
									:disabled="isDisabled"
									:previewFullImage="false"
									:deletable="false"
									name="6"
									:maxCount="1"
									width="250"
									height="150"
									@afterRead="afterReadhzBackCard" 
								>
									<image  :src="model1.userInfo.hzBackCard"
									mode="widthFix" style="width: 250px;height: 150px;"></image>
									<p class="uploadInfo">上传患者身份证背面照</p>
								</u-upload>
							</u-form-item>
							
							
							<!-- <template v-if="receiveUser">
								<u-form-item
										label="收件人姓名"
										prop="receiveUser"
										borderBottom
										style="margin-bottom: 10px;">
									<u--input
											v-model="receiveUser"
											border="none"
											placeholder="请输入内容"
											:disabled="isDisabled"
											disabledColor="#ffffff" 
									></u--input>
								</u-form-item>
							</template>
							
							<template v-if="receiveAddress">
								<u-form-item
										label="收货地址"
										prop="receiveAddress"
										borderBottom
										style="margin-bottom: 10px;">
									<u--input
											v-model="receiveAddress"
											border="none"
											placeholder="请输入内容"
											:disabled="isDisabled"
											disabledColor="#ffffff" 
									></u--input>
								</u-form-item>
							</template> -->
							
							
						</u--form>	
					</view>
		</view>	
		
		<view class="submitBtn" v-if="!isDisabled"  style="padding: 0px;justify-content: center !important;">
			<view class="btnBoxW" style="width: 90%;">
				<u-button  :customStyle='btnStyle'  type="primary" @click="copyBtn"  shape='circle' text="下一步"></u-button>
			</view>
		</view>
		
		
		
		<template v-if="status == '0' || status == '3'">
			<view class="submitBtn" v-if="isDisabled">
				<view class="btnBoxW" style="width: 45%;">
					<u-button :plain="true" :customStyle='btnStyle'  type="primary" @click="cancelApplay"  shape='circle' text="取消申请"></u-button>
				</view>
				<view class="btnBoxW" style="width: 45%;">
					<u-button  :customStyle='btnStyle'  type="primary" @click="copyRepeat"  shape='circle' text="重新申请"></u-button>
				</view>
			</view>
		</template>
		
	</view>
	
</template>

<script>
	import{
		formatDate,
		isBlobURL,
		convertImageToBase64
	}from '@/utils/index.js'
	import{
		saveApply,
		uploadImg,
		searchBlh,
		getApplyDetails
	}from '@/api/index.js'
import { log } from 'util';
	export default{
		data(){
			return{
				showMask:false,
				receiveAddress:'',
				receiveUser:'',
				notifyShow:true,
				status:'0',//0待提交，1待审核，2审核通过，3审核不通过，4已支付，5已邮寄，9已关闭
				isDisabled:true,
				allChecked:false,
				detailsId:'',
				checked:false,
				labelStyle:{
					fontWeight:'bold',
					fontSize:'15px'
				},
				btnStyle:{
					fontSize:'16px',
					fontWeight:'bold',
					height:'45px'
				},
				type:'',
				current:0,
				dateShow:false,
				showDec:false,
				dateTime:this.$utils.formatDate(new Date()),
				showSex: false,
				decShow:false,
				isSelf:false,
				acontent:[],
				model1: {
					userInfo: {
						id:'',
						atype:0,
						hzxm: '',
						hzsfzh:'',
						hzlxdh:'',
						blh: '',
						cyks:'',
						cyrq:this.$utils.formatDate(new Date()),
						anum:1,
						acontent:'',
						remarks:'',
						areason:'',
						aotherReason:'',
						hzHoldCard:'/static/img/icon1.png',
						hzFrontCard:'/static/img/icon2.png',
						hzBackCard:'/static/img/icon3.png',
						proxyHoldCard:'/static/img/icon1.png',
						proxyFrontCard:'/static/img/icon2.png',
						proxyBackCard:'/static/img/icon3.png',
						
						
					},
				},
				hzHoldCard:[],
				hzFrontCard:[],
				hzBackCard:[],
				proxyHoldCard:[],
				proxyFrontCard:[],
				proxyBackCard:[],
				fileListUrl:[],
				checkboxList1:[
					//病案首页，入院记录，出院记录，手术记录，病理报告，医学影像检查资料，体温单，医嘱单
					{
						name: '病案首页',
						disabled: false,
						id:'1'
					},
					{
						name: '入院记录',
						disabled: false,
						id:'2'
					},
					{
						name: '出院记录',
						disabled: false,
						id:'3'
					},
					{
						name: '手术记录',
						disabled: false,
						id:'4'
					},
					{
						name: '病理报告',
						disabled: false,
						id:'5'
					},
					{
						name: '医学影像检查资料',
						disabled: false,
						id:'7'
					},
					{
						name: '体温单',
						disabled: false,
						id:'6'
					},
					{
						name: '医嘱单',
						disabled: false,
						id:'10'
					}
				],
				actions: [],
				actionsDec:[{
					name: '请假',
					},
					{
						name: '报销',
					},
					{
						name: '其他',
					}],
				radiolist1: [
					{
				        name: '本人申请',
						id:'0',
				        disabled: false
				    },
				    {
				        name: '代理人申请',
						id:'1',
				        disabled: false
				    }
				],
				rules: {
					'userInfo.hzxm': {
						type: 'string',
						required: true,
						message: '请填写姓名',
						trigger: ['blur', 'change']
					},
					'userInfo.hzsfzh': [
						{
							type: 'string',
							required: true,
							message: '请填写身份证号',
							trigger: ['blur', 'change']
						},
						{
							// 自定义验证函数，见上说明
							validator: (rule, value, callback) => {
								// 上面有说，返回true表示校验通过，返回false表示不通过
								// uni.$u.test.idCard()就是返回true或者false的
								return uni.$u.test.idCard(value);
							},
							message: '身份证号码不正确',
							// 触发器可以同时用blur和change
							trigger: ['change','blur'],
						}
					],
					'userInfo.hzlxdh':[
						{
							type: 'string',
							required: true,
							message: '请填写手机号',
							trigger: ['blur', 'change']
						},
						{
							// 自定义验证函数，见上说明
							validator: (rule, value, callback) => {
								// 上面有说，返回true表示校验通过，返回false表示不通过
								// uni.$u.test.mobile()就是返回true或者false的
								return uni.$u.test.mobile(value);
							},
							message: '手机号码不正确',
							// 触发器可以同时用blur和change
							trigger: ['change','blur'],
						}
						
					],
					'userInfo.blh': {
						type: 'string',
						required: true,
						message: '请选择住院号',
						trigger: ['blur', 'change']
					},
					'userInfo.cyks': {
						type: 'string',
						required: true,
						message: '请填写出院科室',
						trigger: ['blur', 'change']
					},
					'userInfo.areason': {
						type: 'string',
						required: true,
						message: '请选择事由',
						trigger: ['blur', 'change']
					},
					'userInfo.aotherReason': {
						type: 'string',
						required: true,
						message: '请填写其他事由',
						trigger: ['blur', 'change']
					}
				},
				radio: '',
				switchVal: false
			}
		},
		onLoad(option) {
			if(option && option.id){
				this.detailsId = option.id;
			}
		},
		onShow() {
			this.getDetails(this.detailsId);
			this.showMask = false;
		},
		methods: {
			getDetails(id){
				uni.showLoading({
					title:'加载中...'
				})
				getApplyDetails(id).then(res=>{
					uni.hideLoading()
					const Data = res.retData;
					const formData = this.model1.userInfo;
					for(let key in Data){
						if(formData.hasOwnProperty(key)){
							formData[key] = Data[key]
						}
					}
					
					this.model1.userInfo = formData;
					const receiveProvince = Data.receiveProvince??'';
					const receiveCity = Data.receiveCity??'';
					const receiveDistrict = Data.receiveDistrict??'';
					const receiveStreet = Data.receiveStreet??'';
					const receiveAddr = Data.receiveAddr??'';
					
					this.receiveAddress = receiveProvince+receiveCity+receiveDistrict+receiveStreet+receiveAddr;
					this.receiveUser = Data.receiveUser??'';
					this.status = Data.status;
					const checkRemark = Data.checkRemark;
					//0待提交，1待审核，2审核通过，3审核不通过，4已支付，5已邮寄，9已关闭
					console.log(this.status,"============");
					if(this.status == '0'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'warning',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"待提交",
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '1'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'primary',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"待审核",
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '2'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'success',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"审核通过",
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '3'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'success',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:`审核不通过,${checkRemark}`,
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '4'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'success',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"已支付",
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '5'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'success',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"已邮寄",
						            safeAreaInsetTop:false
						        })
					}else if(this.status == '9'){
						this.$refs.uNotify.show({
						            top: -3,
						            type: 'error',
						            color: '#fff',
						            duration: 0,
						            fontSize: 18,
									message:"已关闭",
						            safeAreaInsetTop:false
						        })
					}
					console.log(this.model1.userInfo,"this.model1.userInfo",formData,this.status)
					this.acontent = Data.acontent.split(',');
					if(this.model1.userInfo.atype == 1){
						this.isSelf = true;
					}else{
						this.isSelf = false;
					}
					console.log(this.acontent.length,"this.acontent.length");
					if(this.acontent.length == 8){
						this.allChecked = true
					}else{
						this.allChecked = false
					}
				})
			},
			sexSelect(e) {
				this.model1.userInfo.blh = e.name
			},
			decSelect(e) {
				this.model1.userInfo.areason = e.name
				
			},
			dateConfirm(val){
				this.model1.userInfo.cyrq = this.$utils.formatDate(val.value);
				//console.log(val,this.$utils.formatDate(val.value),this.model1.userInfo.date);
				this.dateShow = false;
			},
			groupChange(n) {
				if(n == 0){
					this.isSelf = false
				}else{
					this.isSelf = true
				}
			    /* console.log('groupChange', n,this.model1.userInfo.atype); */
			},
			
			//身份证失去焦点事件
			blurSfzEvent(value){
				console.log(value);
				if(value){
					uni.showLoading({
						title:'加载中...'
					})
					searchBlh(value).then(res=>{
						uni.hideLoading()
						const blhArr = [];
						const data = res.retData;
						if(data.length != 0){
							data.forEach(item=>{
								blhArr.push({'name':item.blh})
							})
							this.actions = blhArr;
						}else{
							uni.showToast({
								title:'暂未查询到该患者的住院信息',
								icon:'none'
							})
						}
						
					})
				}else{
					uni.showToast({
						title:'请输入身份证号',
						icon:'none'
					})
				}
				
			},
			
			/* 取消申请 */
			cancelApplay(){
				uni.showLoading({
					title:'加载中...'
				})
				const params={
					id:this.model1.userInfo.id,
					status:"9"
				}
				saveApply(params).then(res=>{
					uni.hideLoading()
					uni.showToast({
						title:res.retMsg,
						icon:'none'
					})
					this.getDetails(this.detailsId)
					console.log(res,"====");
				})
				
			},
			
			/* 重新提交申请 */
			copyRepeat(){
				this.isDisabled = false;
				this.blurSfzEvent(this.model1.userInfo.hzsfzh);
				this.hzHoldCard.push({url:this.model1.userInfo.hzHoldCard});
				this.hzFrontCard.push({url:this.model1.userInfo.hzFrontCard});
				this.hzBackCard.push({url:this.model1.userInfo.hzBackCard});
				if(this.model1.userInfo.atype == '1'){
					//代理人申请
					this.proxyHoldCard.push({url:this.model1.userInfo.proxyHoldCard});
					this.proxyFrontCard.push({url:this.model1.userInfo.proxyFrontCard});
					this.proxyBackCard.push({url:this.model1.userInfo.proxyBackCard});
				}
			},
			/* 提交 */
			copyBtn(){
				this.$refs.uForm.validate().then(res => {
					if(this.acontent.length == 0){
						uni.showToast({
							title:'请选择复印内容',
							icon:"error"
						})
						return
					}
					this.model1.userInfo.acontent = this.acontent.toString();
					if(this.hzHoldCard.length == 0){
						uni.showToast({
							title:'请上传患者手持身份证半身照片',
							icon:"error"
						})
						return
					}
					if(this.hzFrontCard.length == 0){
						uni.showToast({
							title:'请上传患者身份证正面照',
							icon:"error"
						})
						return
					}
					if(this.hzBackCard.length == 0){
						uni.showToast({
							title:'请上传患者身份证背面照',
							icon:"error"
						})
						return
					}
					var UploadImgArr = this.hzHoldCard.concat(this.hzFrontCard,this.hzBackCard);
					if(this.model1.userInfo.atype == 1){
						if(this.proxyHoldCard.length == 0){
							uni.showToast({
								title:'请上传代理人手持身份证半身照片',
								icon:"error"
							})
							return
						}
						if(this.proxyFrontCard.length == 0){
							uni.showToast({
								title:'请上传代理人身份证正面照',
								icon:"error"
							})
							return
						}
						if(this.proxyBackCard.length == 0){
							uni.showToast({
								title:'请上传代理人身份证背面照',
								icon:"error"
							})
							return
						}
						UploadImgArr = UploadImgArr.concat(this.proxyHoldCard,this.proxyFrontCard,this.proxyBackCard);
					}
					uni.showLoading({
						title:'加载中...'
					})
					
					this.showMask = true;
			
					console.log(this.model1.userInfo,"提交的表单数据======");
					saveApply(this.model1.userInfo).then(res=>{
						uni.hideLoading()
						if(res.retCode == "SUCCESS"){
							uni.showToast({
								title:"提交成功!",
								icon:'none'
							})
							const Id = this.model1.userInfo.id;
							/* uni.setStorageSync('id',Id); */
							uni.navigateTo({
								url:"/pages/address/address?id="+Id
							})
						}else{
							uni.showToast({
								title:res.retMsg,
								icon:'none'
							})
						}
						
					})
					
					
					
					
					
					
				}).catch(errors => {
					console.log(errors,"errors");
					uni.$u.toast('请填写完整!')
				})
				
			},
			//选择复印内容
			selectAllCheckbox(value){
				if(value){
					this.acontent = this.checkboxList1.map(item=>item.id)
					this.checked = true
				}else{
					this.checked = false
					this.acontent = []
				}
				console.log(this.acontent,"选择复印内容");
			},
			// 图片
			async afterReadProxyHoldCard(event){
				// 获取选中的图片
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.proxyHoldCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.proxyHoldCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				await uploadImg(this.model1.userInfo.proxyHoldCard).then(res=>{
					this.model1.userInfo.proxyHoldCard = res.url
					this.proxyHoldCard = [];
					this.proxyHoldCard.push({url:res.url})
				})
				
			},
			// 图片上传代理人身份证正面照
			async afterReadproxyFrontCard(event){
				// 获取选中的图片
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.proxyFrontCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.proxyFrontCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				await uploadImg(this.model1.userInfo.proxyFrontCard).then(res=>{
					this.model1.userInfo.proxyFrontCard = res.url
					this.proxyFrontCard = [];
					this.proxyFrontCard.push({url:res.url})
				})
				
			},
			// 图片上传代理人身份证背面照
			async afterReadproxyBackCard(event){
				// 获取选中的图片
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.proxyBackCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.proxyBackCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				await uploadImg(this.model1.userInfo.proxyBackCard).then(res=>{
					this.model1.userInfo.proxyBackCard = res.url
					this.proxyBackCard = [];
					this.proxyBackCard.push({url:res.url})
				})
				
			},
			/* 患者手持身份证正面照 */
			async afterReadhzHoldCard(event){
				// 获取选中的图片
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.hzHoldCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.hzHoldCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				await uploadImg(this.model1.userInfo.hzHoldCard).then(res=>{
					this.model1.userInfo.hzHoldCard = res.url
					this.hzHoldCard = [];
					this.hzHoldCard.push({url:res.url})
				})
			},
			/* 患者身份证正面照 */
		    async afterReadhzFrontCard(event){
				// 获取选中的图片
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.hzFrontCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.hzFrontCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				
				await uploadImg(this.model1.userInfo.hzFrontCard).then(res=>{
					this.model1.userInfo.hzFrontCard = res.url
					this.hzFrontCard = [];
					this.hzFrontCard.push({url:res.url})
				})
			},
			/* 患者身份证背面照 */
			async afterReadhzBackCard(event){
				const file = event.file;
				if (file.url) {
					this.model1.userInfo.hzBackCard = file.url; // 如果已经是文件对象，直接使用文件对象的url属性
				  } else {
					const reader = new FileReader();
					reader.onload = (e) => {
					  this.model1.userInfo.hzBackCard = e.target.result;
					};
					reader.readAsDataURL(file);
				}
				await uploadImg(this.model1.userInfo.hzBackCard).then(res=>{
					this.model1.userInfo.hzBackCard = res.url
					this.hzBackCard = [];
					this.hzBackCard.push({url:res.url})
				})
			},
		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			/* this.$refs.uForm.setRules(this.rules) */
		}
		
	}
	
	
	
</script>

<style scoped lang="scss">
	.copyApplay{
		padding-top: 35px;
		.copyApplayPadding{
			padding: 20upx;
			padding-bottom: 150upx;
			box-sizing: border-box;
			.message{
				font-size: 28upx;
				/* margin-top: 20upx; */
				/* padding: 20upx;
				box-sizing: border-box; */
			}
			.info{
				font-size: 30upx;
				margin: 20px 0px;
				color: #e9a510;
			}
			.uploadInfo{
				text-align: center;
				font-size: 30upx;
			}
			.picTitle{
				color: #303133;
				font-size: 30upx;
				font-weight: bold;
			}
			
		}
		
	}
	::v-deep .u-upload__wrap{
		align-items: center;
		justify-content: center;
		
		
	}
	.submitBtn{
		display: flex;
		flex-direction: row;
		justify-content:space-between !important;
		padding: 0px 5%;
		box-sizing: border-box;
		
	}
	
	::v-deep .u-form-item__body__right__message[data-v-03e1ba13]{
		font-size: 30upx !important;
	}
	
	
</style>